perm filename SPIDE2.LSP[F81,JMC]1 blob sn#629509 filedate 1981-12-16 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	 spide2.lsp[f81,jmc]	spider player and referee
C00004 ENDMK
CāŠ—;
;;; spide2.lsp[f81,jmc]	spider player and referee
;;; using move.lsp[f81,jmc]
;;; The object is to get a transparent LISP program that closely models
;;; the physical actions involved in playing the game.

;;; shuffles a list in random order
(defun shuffle (u)
       (if (or (null u) (null (cdr u)))
	   u
	   (shuffle1 u nil nil)))
(defun shuffle1 (u w1 w2)
       (if (null u)
	   (append (shuffle w1) (shuffle w2))
	   (= 0 (random 2))
	   (shuffle1 (cdr u) (cons (car u) w1) w2)
	   (shuffle1 (cdr u) w1 (cons (car u) w2))
	   ))


(setq piles '(p1 p2 p3 p4 p5 p6 p7 p8 p9 p10))

(setq suits '(C D H S))

(setq denoms '(1 2 3 4 5 6 7 8 9 10 11 12 13))

(defun cartesian (u v)
       (mapappend
	(function (lambda (x) (mapcar
			       (function (lambda (y) (list x y)))
			       v)))
	u))

(defun mapappend (f u) (if (null u) nil (append (funcall f (car u))
						(mapappend f (cdr u)))))


(setq ideck (append (cartesian suits denoms) (cartesian suits denoms)))